//
//  ServeDredgeCollectViewController.m
//  Ai
//
//  Created by 杜超男 on 2019/3/6.
//  Copyright © 2019年 杜超男. All rights reserved.
//

#import "ServeDredgeCollectViewController.h"
#import "ServeDredgeCollectTableViewCell.h"
#import "DetailsViewController.h"
#import "Masonry.h"
@interface ServeDredgeCollectViewController ()<UITableViewDelegate , UITableViewDataSource>
@property (nonatomic , strong)UIButton *SynthesizeBtn;//综合按钮
@property (nonatomic , strong)UIButton *VIPUserCountAscendingOrderBtn;//VIP用户数升序
@property (nonatomic , strong)UIButton *VIPUserCountDescendingOrderBtn;//VIP用户数降序
@property (nonatomic , strong)UITableView *tableView;
@end

@implementation ServeDredgeCollectViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIView *backgroundColor = [[UIView alloc] initWithFrame:self.view.frame];
    backgroundColor.backgroundColor = [UIColor colorWithRed:240/255.0 green:240/255.0 blue:240/255.0 alpha:1];
    [self.view addSubview:backgroundColor];
    [self.view addSubview:self.SynthesizeBtn];
    [self.view addSubview:self.VIPUserCountAscendingOrderBtn];
    [self.view addSubview:self.VIPUserCountDescendingOrderBtn];
    [self.view addSubview:self.tableView];
//    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(50);
//        make.left.right.mas_equalTo(0);
////        make.size.height.mas_equalTo(450);
//        make.bottom.mas_equalTo(120);
//    }];
    [_tableView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view.mas_safeAreaLayoutGuideTop).inset(45);
        make.left.mas_equalTo(15);
        make.right.mas_equalTo(-15);
        make.bottom.mas_equalTo(0);
    }];
}
-(UITableView *)tableView{
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(15, 50, self.view.frame.size.width-30, self.view.frame.size.height - 50) style:UITableViewStyleGrouped];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.rowHeight = 205;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.showsVerticalScrollIndicator = NO;
    [_tableView registerNib:[UINib nibWithNibName:@"ServeDredgeCollectTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
    return _tableView;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    ServeDredgeCollectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.01;
}
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 0.01)];
    headerView.backgroundColor = [UIColor clearColor];
    return headerView;
}
//综合按钮
-(UIButton *)SynthesizeBtn{
    _SynthesizeBtn = [[UIButton alloc] initWithFrame:CGRectMake(15, 16, 50, 18)];
    [_SynthesizeBtn setTitle:@"综合" forState:UIControlStateNormal];
    //rgba(54/255.0, 139/255.0, 39/255.0, 1)
    [_SynthesizeBtn setTitleColor:[UIColor colorWithRed:54/255.0 green:139/255.0 blue:39/255.0 alpha:1] forState:UIControlStateNormal];
    //rgba(222/255.0, 245/255.0, 218/255.0, 1)
    [_SynthesizeBtn setBackgroundColor:[UIColor colorWithRed:222/255.0 green:245/255.0 blue:218/255.0 alpha:1]];
    _SynthesizeBtn.layer.cornerRadius = 9;
    _SynthesizeBtn.layer.masksToBounds = YES;
    _SynthesizeBtn.titleLabel.font = [UIFont systemFontOfSize:11];
    _SynthesizeBtn.layer.borderColor = [[UIColor colorWithRed:54/255.0 green:139/255.0 blue:39/255.0 alpha:1.0] CGColor];
    _SynthesizeBtn.layer.borderWidth = 1;
    return _SynthesizeBtn;
}
//VIP用户数升序
-(UIButton *)VIPUserCountAscendingOrderBtn{
    _VIPUserCountAscendingOrderBtn = [[UIButton alloc] initWithFrame:CGRectMake(80, 16, 100, 18)];
    [_VIPUserCountAscendingOrderBtn setTitle:@"VIP用户数升序" forState:UIControlStateNormal];
    _VIPUserCountAscendingOrderBtn.titleLabel.font = [UIFont systemFontOfSize:11];
    //rgba(54/255.0, 139/255.0, 39/255.0, 1)
    //文字颜色
    //[_VIPUserCountAscendingOrderBtn setTitleColor:[UIColor colorWithRed:54/255.0 green:139/255.0 blue:39/255.0 alpha:1] forState:UIControlStateNormal];
    //背景颜色rgba(102, 102, 102, 1)
    [_VIPUserCountAscendingOrderBtn setTitleColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1] forState:UIControlStateNormal];
    //背景颜色rgba(222/255.0, 245/255.0, 218/255.0, 1)
    //[_VIPUserCountAscendingOrderBtn setBackgroundColor:[UIColor colorWithRed:222/255.0 green:245/255.0 blue:218/255.0 alpha:1]];
    //rgba(241, 240, 240, 1)
    [_VIPUserCountAscendingOrderBtn setBackgroundColor:[UIColor colorWithRed:241/255.0 green:240/255.0 blue:240/255.0 alpha:1]];
    _VIPUserCountAscendingOrderBtn.layer.cornerRadius = 9;
    _VIPUserCountAscendingOrderBtn.layer.masksToBounds = YES;
    _VIPUserCountAscendingOrderBtn.titleLabel.font = [UIFont systemFontOfSize:11];
    //边框颜色
   // _VIPUserCountAscendingOrderBtn.layer.borderColor = [[UIColor colorWithRed:54/255.0 green:139/255.0 blue:39/255.0 alpha:1.0] CGColor];
    //边框Width
    //_VIPUserCountAscendingOrderBtn.layer.borderWidth = 1;
    return _VIPUserCountAscendingOrderBtn;
}
//VIP用户数降序
-(UIButton *)VIPUserCountDescendingOrderBtn{
    _VIPUserCountDescendingOrderBtn = [[UIButton alloc] initWithFrame:CGRectMake(190, 16, 100 , 18)];
    [_VIPUserCountDescendingOrderBtn setTitle:@"VIP用户数降序" forState:UIControlStateNormal];
    //NSLog(@"///%ld",_VIPUserCountDescendingOrderBtn.titleLabel.text.length);
    //rgba(54/255.0, 139/255.0, 39/255.0, 1)
    //文字颜色   102
    [_VIPUserCountDescendingOrderBtn setTitleColor:[UIColor colorWithRed:102/255.0 green:102/255.0 blue:102/255.0 alpha:1] forState:UIControlStateNormal];
    //rgba(222/255.0, 245/255.0, 218/255.0, 1)
    //[_VIPUserCountDescendingOrderBtn setBackgroundColor:[UIColor colorWithRed:222/255.0 green:245/255.0 blue:218/255.0 alpha:1]];
    [_VIPUserCountDescendingOrderBtn setBackgroundColor:[UIColor colorWithRed:241/255.0 green:240/255.0 blue:240/255.0 alpha:1]];
    _VIPUserCountDescendingOrderBtn.layer.cornerRadius = 9;
    _VIPUserCountDescendingOrderBtn.layer.masksToBounds = YES;
    _VIPUserCountDescendingOrderBtn.titleLabel.font = [UIFont systemFontOfSize:11];
    //_VIPUserCountDescendingOrderBtn.layer.borderColor = [[UIColor colorWithRed:54/255.0 green:139/255.0 blue:39/255.0 alpha:1.0] CGColor];
    //_VIPUserCountDescendingOrderBtn.layer.borderWidth = 1;
    return _VIPUserCountDescendingOrderBtn;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [self.navigationController pushViewController:[DetailsViewController new] animated:YES];
}
@end
